using Godot;
using System;
using Newtonsoft.Json;

public partial class trackendpoints : MeshInstance3D
{
	public RobotJoints robotJoints { get; set; }

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		var mainNode = this.Owner;//获取main节点
		//robotJoints = new RobotJoints();
		mainNode.Connect("SignalSendRobotParameters", new Callable(this, "RecieveData"));//连接信号
		GD.Print(mainNode.Name);
	}

	/// <summary>
	/// 接收信息
	/// </summary>
	/// <param name="data">接收到的信息</param>
	public void RecieveData(string data)
	{
		robotJoints = JsonConvert.DeserializeObject<RobotJoints>(data);//解析关节信号
		//currentAngle = (double)robotJoints.GetType().GetProperty($"{Name}Angle").GetValue(robotJoints);
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}
}
